# $Id$
# Maintainer: Qurban Ullah <qurbanullah@avouch.org>
# Contributor: Qurban Ullah <qurbanullah@avouch.org>

pkgbase=gobject-introspection
pkgname=('gobject-introspection' 'gobject-introspection-runtime')
pkgdesc="Introspection system for GObject-based libraries"
pkgver=1.58.0
pkgrel=1
url="https://wiki.gnome.org/Projects/GObjectIntrospection"
arch=('x86_64')
license=('LGPL' 'GPL')
depends=(python python-mako)
makedepends=(cairo git gtk-doc python-sphinx meson)
options=('!emptydirs')
groups=('sys-libs')
_commit=c942279c7c5e2b42c2f060372e15cbf54a5c353f  # tags/1.52.0^0
source=("git+https://git.gnome.org/browse/gobject-introspection#commit=$_commit"
        0001-giscanner-fix-EOF-check-with-flex-2.6.1.patch)
sha256sums=('SKIP'
            'e1333f2eddf23e4d750aa1c39e5fea8264d0586d1916f11188dbd07d4449d81f')

build() {
    cd $pkgbase-$pkgver
    ./configure \
        --prefix=/usr \
        --disable-static \
        --enable-doctool \
        --enable-gtk-doc
    sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
    make ${MAKEFLAGS}
}

package_gobject-introspection-runtime() {
    pkgdesc+=" (runtime library)"
    depends=('glib2')
    cd $pkgbase-$pkgver
    make DESTDIR="$pkgdir" install-libLTLIBRARIES install-typelibsDATA
}

package_gobject-introspection() {
    depends+=("gobject-introspection-runtime=$pkgver")

    cd $pkgbase-$pkgver
    make DESTDIR="$pkgdir" install
    make DESTDIR="$pkgdir" uninstall-libLTLIBRARIES uninstall-typelibsDATA
}
